﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace supermarket.method
{
    internal class Classidadd
    {
        #region  //id自增
        private int _currentNumber;

        public Classidadd(int startNumber)
        {
            _currentNumber = startNumber;
        }

        public string GenerateSerialNumber()   //序列号自增
        {
            return GenerateSerialNumber(++_currentNumber);
        }

        public string GenerateSerialNumber(int number)   //序列号自增，格式上左立一些要求
        {

            string paddedNumber = number.ToString().PadLeft(4, '0'); // 自增数字至少4位数字，不足部分用0填充
            return paddedNumber;
        }

        #endregion
    }
}
